/*
 * @Description: In User Settings Edit
 * @Author: your name
 * @Date: 2019-08-30 17:20:11
 * @LastEditTime: 2019-09-09 16:17:51
 * @LastEditors: Please set LastEditors
 */
import React,{ Component } from "react"
import { connect } from "./self-react-redux"

import { sum,less } from "./redux/reducer"
// @connect(state=>state.compute,{
//     sum,
//     less
// })
// import PropTypes from "prop-types"
import PropTypes from "prop-types"
class App extends Component{
    static contextTypes = {
        store:PropTypes.object
    }
    // // 接收自动放如context
    // constructor(props,context){
    //     super(props,context)
    // }
    // static contextTypes = {
    //     store:PropTypes.object
    // }
    // console.log(this)
    render(){
        console.log(this)
        return (
            <div>
                <h1>当前值：{this.props.number}</h1>
                <div>
                    <button onClick={()=>{this.props.sum()}}>
                        加
                    </button>
                    <button onClick={()=>{this.props.less()}}>
                        减
                    </button>
                </div>
            </div>
        )
    }
}
App = connect(state=>({number:state.number}),{sum,less})(App)
export  default App; 